import ajax from './ajax'

const baseUrl = "http://localhost:3001"

// 请求登陆
export const reqLogin = (user) => ajax(`${baseUrl}/login`, user, 'POST')

// 获取用户信息
export const reqUser = (data) =>ajax(`${baseUrl}/user`,data)
export const reqUserName = (data) =>ajax(`${baseUrl}/user/name`,data,"POST")

// 角色信息
export const reqRole = (userRole) => ajax(`${baseUrl}/role`,userRole)
export const reqRoleName = (RoleInfor) => ajax(`${baseUrl}/role/teacher`,RoleInfor)
export const reqUpdateRole = (userInfor) => ajax(`${baseUrl}/role/update`, userInfor, 'POST')
export const reqUpadtePassword =(password) => ajax(`${baseUrl}/role/password`,password,"POST")

// 获取课程列表
export const reqCurriculum = (RoleInfor) => ajax(`${baseUrl}/professional`,RoleInfor)
export const reqSearchCur = (searchInfor) => ajax(`${baseUrl}/professional`,searchInfor,"POST")

// 成绩
export const reqStuGrades = (RoleInfor) => ajax(`${baseUrl}/grade/student`,RoleInfor)
export const reqSearchGra = (searchInfor) => ajax(`${baseUrl}/grade/student`,searchInfor,"POST")
export const reqTeaGrades = (RoleInfor) => ajax(`${baseUrl}/grade/teacher`,RoleInfor,"POST")
export const deleteGrades = (RoleInfor) => ajax(`${baseUrl}/grade/teacher`,RoleInfor,"DELETE")
export const addGrade= (data) => ajax(`${baseUrl}/grade`,data,"POST")
export const updateGrade = (data) => ajax(`${baseUrl}/grade`,data,"PUT")

// 考试
export const reqExamination = (RoleInfor) => ajax(`${baseUrl}/examination`,RoleInfor)
export const stuSearchExa = (searchInfor) => ajax(`${baseUrl}/examination/student`,searchInfor,"POST")
export const teaSearchExa = (searchInfor) => ajax(`${baseUrl}/examination`,searchInfor,"POST")
export const addExamination = (data) => ajax(`${baseUrl}/examination/teacher`,data,"POST")
export const updateExa = (data) => ajax(`${baseUrl}/examination`,data,"PUT")
export const deleteExa = (data) => ajax(`${baseUrl}/examination`,data,"DELETE")

// 学籍
export const reqStuStatus = (RoleInfor) => ajax(`${baseUrl}/stuStatus`, RoleInfor)

// 课表
export const reqCourseList = (RoleInfor) => ajax(`${baseUrl}/course`,RoleInfor)
export const reqSearchCou = (searchInfor) => ajax(`${baseUrl}/course`,searchInfor,"POST")
export const reqAddCourse = (data) => ajax(`${baseUrl}/course/teacher`,data,"POST")
export const updateCourse = (data) => ajax(`${baseUrl}/course`,data,"PUT")

// 公告
export const reqAnnouncementList = (data) => ajax(`${baseUrl}/announcement`,data)
export const reqTimeToSearch = (data) =>ajax(`${baseUrl}/announcement/time`,data)
export const reqAddAnnouncement = (data) => ajax(`${baseUrl}/announcement`,data,"POST")
export const reqUpdateAnnouncement = (data) => ajax(`${baseUrl}/announcement`,data,"PATCH")
export const deleteAnnouncement = (data) => ajax(`${baseUrl}/announcement`,data,"DELETE")

// 额外信息（教师教授课程、班级、专业）
export const reqClasses = (RoleInfor) => ajax(`${baseUrl}/additional/classes`,RoleInfor)
export const reqTeacher = ()=>ajax(`${baseUrl}/additional/teacher`)
export const reqAllCurriculum =() => ajax(`${baseUrl}/additional/curriculum`)
export const reqProfessional = () =>ajax(`${baseUrl}/additional/professional`)
export const reqRestrictedCur = (data) => ajax(`${baseUrl}/additional/restricted/curriculum`,data)

// 获取教室
export const reqClassrooms = ()=>ajax(`${baseUrl}/classroom`)

// 获取课程列表
export const reqCurriculums = () =>ajax(`${baseUrl}/curriculum`)
export const teaSearchCur = (data)=>ajax(`${baseUrl}/curriculum`,data,"POST")
export const UpdateCur = (data) =>ajax(`${baseUrl}/curriculum`,data,"PUT")
export const deleteCur = (data) =>ajax(`${baseUrl}/curriculum`,data,"DELETE")
export const addCurriculum = (data) => ajax(`${baseUrl}/curriculum/add`,data,"POST")

// 学生信息
export const reqstudentsInfor =(data) =>ajax(`${baseUrl}/studentsInfor`,data)
export const addStudentInfor = (data) =>ajax(`${baseUrl}/studentsInfor`,data,"POST")
export const deleteStudentInfor = (data) =>ajax(`${baseUrl}/studentsInfor`,data,"DELETE")

